package com.example.demo.myqueue;

import java.util.concurrent.DelayQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class DelayQueueTest {


    public static void main(String[] args) {
        DelayQueue<Message> queue = new DelayQueue<>();
        Message m = new Message(1, "合同到期", "你的合同已经到期", 3000);
        Message m2 = new Message(2, "hello", "你好", 9000);
        queue.offer(m);
        queue.offer(m2);
        Consumer c = new Consumer(queue);
        ExecutorService pool = Executors.newFixedThreadPool(5);
        pool.execute(c);
    }
}
